{% spaceless %}

{% set rows = [] %}

{% set rows = rows|merge([{
    'id': food.publicId,
    'name': food.name,
    'energy': food.energy,
    'protein': food.protein,
    'carbohydrates': food.carbohydrates,
    'starch': food.starch,
    'sugar': food.sugar,
    'fat': food.fat,
    'fattyAcidsSaturated': food.fattyAcidsSaturated,
    'fattyAcidsMonounsaturated': food.fattyAcidsMonounsaturated,
    'fattyAcidsPolyunsaturated': food.fattyAcidsPolyunsaturated,
    'water': food.water,
    'alcohol': food.alcohol,
    'fiber': food.fiber,
    'calcium': food.calcium,
    'copper': food.copper,
    'iodine': food.iodine,
    'iron': food.iron,
    'magnesium': food.magnesium,
    'manganese': food.manganese,
    'phosphorus': food.phosphorus,
    'potassium': food.potassium,
    'selenium': food.selenium,
    'sodium': food.sodium,
    'zinc': food.zinc,
    'vitaminA': food.vitaminA,
    'vitaminB1': food.vitaminB1,
    'vitaminB2': food.vitaminB2,
    'vitaminB3': food.vitaminB3,
    'vitaminB5': food.vitaminB5,
    'vitaminB6': food.vitaminB6,
    'vitaminB9': food.vitaminB9,
    'vitaminB12': food.vitaminB12,
    'vitaminC': food.vitaminC,
    'vitaminD': food.vitaminD,
    'vitaminE': food.vitaminE,
}]) %}

{% set response = {
    'success': true,
    'count': rows|length,
    'rows': rows
} %}

{{ response|json_encode|raw }}

{% endspaceless %}